﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class FloatExtension
{
    /// <summary>
    /// 保留2位小数
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
   public static float Round(this float value)
    {
        float temp = value;
        int i = (int)(temp * 100);
        temp = (float)(i * 1.0) / 100;
        return temp;
    }
    /// <summary>
    /// 相等
    /// </summary>
    /// <param name="value"></param>
    /// <returns></returns>
    public static bool Equal(this float value,float value2,float Comparisonvlaue=0.001f)
    {
        
        return Mathf.Abs(value- value2) < Comparisonvlaue;
    }
    
}
